# http://vip.91p07.com/uvideos.php?UID=c82bCeLSDxnJsbCZh82FHzw1OmkMcbVEaZkIDAVB4q3pmjKa&type=public
# https://cdn.91p07.com//m3u8/476092/4760920.ts
# https://cdn.91p07.com//m3u8/476092/476092142.ts

import requests

for i in range(0, 142):
    url1 = "https://cdn.xxxx.com//m3u8/476092/476092"
    url2 = str(i) + ".ts"
    url = url1 + url2  # 因为资源地址是连续且有规律的，所以将其拆分

    root = "download/"  # 目录自己建
    path = root + url2.zfill(5)  # 路径分为两部分根目录和文件名，用zfill补0
    print(url)
    r = requests.get(url)  # 获取资源地址

    with open(path, 'wb') as f:  # 文件的打开和保存
        f.write(r.content)
        f.close()
        print("第{}文件保存成功".format(i))
